package com.apanal.qlife.sys.model;

import java.util.List;

import com.apanal.qlife.common.model.BaseModel;
import com.apanal.qlife.common.model.ModelConvert;
import com.apanal.qlife.org.model.Organization;

/**
 * 用户实体类
 * 
 * 
 * @author shuliangxing
 * 
 * @date 2015-8-31下午5:46:35
 */
public class User extends BaseModel {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1818538156046876019L;

	/**
	 * id
	 */
	private Long useId;

	/**
	 * id字符串,逗号分隔
	 */
	private String useIds;

	/**
	 * 用户名,即用户账号,唯一
	 */
	private String useName;

	/**
	 * 描述
	 */
	private String useDesc;

	/**
	 * 密码
	 */
	private String usePassword;

	/**
	 * 手机号码(为了提高索引效率,为空时填0)
	 */
	private String useMobilePhone;

	/**
	 * 邮箱
	 */
	private String useEmail;

	/**
	 * 昵称
	 */
	private String useNickname;

	/**
	 * 用户真实姓名
	 */
	private String useRealName;

	/**
	 * 性别,外键,来自t_dictionary.SEX
	 */
	private Integer useSex;

	/**
	 * 座机号码
	 */
	private String useTelephone;

	/**
	 * 身份证
	 */
	private String useIdentityCard;

	/**
	 * 用户头像,外键,来自文件表
	 */
	private Long useHeadImg;

	/**
	 * 用户类型,1:app用户, 2:管理后台用户, 9:T-Linx用户
	 */
	private Integer useType;

	/**
	 * 本表父id
	 */
	private Long usePId;

	/**
	 * 父id字符串,斜线"/"分隔
	 */
	private String usePIds;

	/**
	 * 小区id,外键来自小区表
	 */
	private Long comId;

	/**
	 * 手机系统，0=ios,1=android
	 */
	private Integer usePhoneOs;

	/**
	 * 手机型号
	 */
	private String usePhoneModel;

	/**
	 * 账户是否锁定, 1:是, 0:否
	 */
	private Integer useLocked;

	/**
	 * 机构id
	 */
	private Long orgId;

	/**
	 * 头像
	 */
	private File headImgFile;

	/**
	 * 角色集合
	 */
	private List<Role> rolList;

	/**
	 * 角色id字符串,逗号分隔
	 */
	private String rolIds;

	/**
	 * 角色名称字符串,逗号分隔
	 */
	private String rolNames;

	/**
	 * 群组集合
	 */
	private List<Group> groList;

	/**
	 * 群组id字符串,逗号分隔
	 */
	private String groIds;

	/**
	 * 群组名称字符串,逗号分隔
	 */
	private String groNames;

	/**
	 * 机构集合
	 */
	private Organization org;

	public Long getUseId() {
		return useId;
	}

	public void setUseId(Long useId) {
		this.useId = useId;
	}

	public String getUseName() {
		return useName;
	}

	public void setUseName(String useName) {
		this.useName = useName == null ? null : useName.trim();
	}

	public String getUsePassword() {
		return usePassword;
	}

	public void setUsePassword(String usePassword) {
		this.usePassword = usePassword == null ? null : usePassword.trim();
	}

	public String getUseMobilePhone() {
		return useMobilePhone;
	}

	public void setUseMobilePhone(String useMobilePhone) {
		this.useMobilePhone = useMobilePhone == null ? null : useMobilePhone
				.trim();
	}

	public String getUseEmail() {
		return useEmail;
	}

	public void setUseEmail(String useEmail) {
		this.useEmail = useEmail == null ? null : useEmail.trim();
	}

	public String getUseNickname() {
		return useNickname;
	}

	public void setUseNickname(String useNickname) {
		this.useNickname = useNickname == null ? null : useNickname.trim();
	}

	public String getUseRealName() {
		return useRealName;
	}

	public void setUseRealName(String useRealName) {
		this.useRealName = useRealName == null ? null : useRealName.trim();
	}

	public Integer getUseSex() {
		return useSex;
	}

	public void setUseSex(Integer useSex) {
		this.useSex = useSex;
	}

	public String getUseTelephone() {
		return useTelephone;
	}

	public void setUseTelephone(String useTelephone) {
		this.useTelephone = useTelephone == null ? null : useTelephone.trim();
	}

	public String getUseIdentityCard() {
		return useIdentityCard;
	}

	public void setUseIdentityCard(String useIdentityCard) {
		this.useIdentityCard = useIdentityCard == null ? null : useIdentityCard
				.trim();
	}

	public Long getUseHeadImg() {
		return useHeadImg;
	}

	public void setUseHeadImg(Long useHeadImg) {
		this.useHeadImg = useHeadImg;
	}

	public Integer getUseType() {
		return useType;
	}

	public void setUseType(Integer useType) {
		this.useType = useType;
	}

	public Long getUsePId() {
		return usePId;
	}

	public void setUsePId(Long usePId) {
		this.usePId = usePId;
	}

	public String getUsePIds() {
		return usePIds;
	}

	public void setUsePIds(String usePIds) {
		this.usePIds = usePIds == null ? null : usePIds.trim();
	}

	public Long getComId() {
		return comId;
	}

	public void setComId(Long comId) {
		this.comId = comId;
	}

	public Integer getUsePhoneOs() {
		return usePhoneOs;
	}

	public void setUsePhoneOs(Integer usePhoneOs) {
		this.usePhoneOs = usePhoneOs;
	}

	public String getUsePhoneModel() {
		return usePhoneModel;
	}

	public void setUsePhoneModel(String usePhoneModel) {
		this.usePhoneModel = usePhoneModel == null ? null : usePhoneModel
				.trim();
	}

	public Integer getUseLocked() {
		return useLocked;
	}

	public void setUseLocked(Integer useLocked) {
		this.useLocked = useLocked;
	}

	public Long getOrgId() {
		return orgId;
	}

	public void setOrgId(Long orgId) {
		this.orgId = orgId;
	}

	public File getHeadImgFile() {
		return headImgFile;
	}

	public void setHeadImgFile(File headImgFile) {
		this.headImgFile = headImgFile;
	}

	public List<Role> getRolList() {
		return rolList;
	}

	public void setRolList(List<Role> rolList) {
		this.rolList = rolList;
	}

	public List<Group> getGroList() {
		return groList;
	}

	public void setGroList(List<Group> groList) {
		this.groList = groList;
	}

	public String getUseIds() {
		return useIds;
	}

	public void setUseIds(String useIds) {
		this.useIds = useIds;
	}

	public String getUseDesc() {
		return useDesc;
	}

	public void setUseDesc(String useDesc) {
		this.useDesc = useDesc;
	}

	public String getRolIds() {
		if ((rolIds == null || "".equals(rolIds)) && rolList != null
				&& !rolList.isEmpty()) {
			return ModelConvert.getIds(rolList);
		} else {
			return rolIds;
		}
	}

	public void setRolIds(String rolIds) {
		this.rolIds = rolIds;
	}

	public String getGroIds() {
		if ((groIds == null || "".equals(groIds)) && groList != null
				&& !groList.isEmpty()) {
			return ModelConvert.getIds(groList);
		} else {
			return groIds;
		}
	}

	public void setGroIds(String groIds) {
		this.groIds = groIds;
	}

	public Organization getOrg() {
		return org;
	}

	public void setOrg(Organization org) {
		this.org = org;
	}

	public String getRolNames() {
		if ((rolNames == null || "".equals(rolNames)) && rolList != null
				&& !rolList.isEmpty()) {
			return ModelConvert.getNames(rolList);
		} else {
			return rolNames;
		}
	}

	public void setRolNames(String rolNames) {
		this.rolNames = rolNames;
	}

	public String getGroNames() {
		if ((groNames == null || "".equals(groNames)) && groList != null
				&& !groList.isEmpty()) {
			return ModelConvert.getNames(groList);
		} else {
			return groNames;
		}
	}

	public void setGroNames(String groNames) {
		this.groNames = groNames;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	@Override
	public String toString() {
		return "User [useId=" + useId + ", useIds=" + useIds + ", useName="
				+ useName + ", useDesc=" + useDesc + ", usePassword="
				+ usePassword + ", useMobilePhone=" + useMobilePhone
				+ ", useEmail=" + useEmail + ", useNickname=" + useNickname
				+ ", useRealName=" + useRealName + ", useSex=" + useSex
				+ ", useTelephone=" + useTelephone + ", useIdentityCard="
				+ useIdentityCard + ", useHeadImg=" + useHeadImg + ", useType="
				+ useType + ", usePId=" + usePId + ", usePIds=" + usePIds
				+ ", comId=" + comId + ", usePhoneOs=" + usePhoneOs
				+ ", usePhoneModel=" + usePhoneModel + ", useLocked="
				+ useLocked + ", orgId=" + orgId + ", headImgFile="
				+ headImgFile + ", rolList=" + rolList + ", rolIds=" + rolIds
				+ ", rolNames=" + rolNames + ", groList=" + groList
				+ ", groIds=" + groIds + ", groNames=" + groNames + ", org="
				+ org + "]";
	}

}